#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
	int a[100];
	int n;
	cin>>n;
	for(int i=0;i<n;i++) cin>>a[i];
	sort(a,a+n);
	int i=1;
	int id=a[0];
	int count=1;
	int max=1;
	while(i<n){
		if(a[i]==a[i-1]){
			count++;
			i++;
			continue;
		}
		if(count>max){
			max=count;
			id=a[i-1];
		}
		count=1;
		i++;
	}
	if(count>max){
			max=count;
			id=a[i-1];
	}
	cout<<id<<" "<<max<<endl;
	return 0;
} 
